package net.lzzy;

import net.lzzy.entity.Role;
import net.lzzy.entity.User;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import java.util.Arrays;

@SpringBootApplication
public class SpringSecurityApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringSecurityApplication.class, args);

//        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
//        Role role1=new Role(1,"ROLE_admin");
//        Role role2=new Role(2,"ROLE_custom");
//        roleRepository.save(role1);
//        roleRepository.save(role2);
//        User user1 = new User(1,"admin",encoder.encode("123"),
//                Arrays.asList(role1,role2));
//        User user2 = new User(1,"tom",encoder.encode("123"),
//                Arrays.asList(role2));
//        userRepository.save(user1);
//        userRepository.save(user2);

    }

}
